package at.fhooe.stefanirndorfer.materials;

public abstract class Material {
	
	
	/** Occlusion = e.g. 0.4f per unit */
	public static final float OCCLUSION_HF = 0.4f;
	public static final float OCCLUSION_LF = 0.01f;
	
	public static final float[] DEFAULT_COLOR = new float[]{0.5f, 0.5f, 0.5f};
	
	protected float occ_hf;
	protected float occ_lf;
	protected float[] color;
	
	// default constructor
	public Material(){
		occ_hf = OCCLUSION_HF;
		occ_lf = OCCLUSION_LF;
		color = DEFAULT_COLOR;
	}
	
	public Material(float occ_hf, float occ_lf, float[] color){
		this.occ_hf = occ_hf;
		this.occ_lf = occ_lf;
	}


	/**
	 * this function returns the gain of a signal which hits an obstacle
	 * a simple linear example (could be replaced with by more realistic one)
	 * @param length
	 * @param occ
	 * @return
	 */
	private float computeAttenuation(float inputGain, double length, float occ){
		return (float) (inputGain - occ*length);
	}

	public float computeHFAtt(float hfGain, double length){
		return computeAttenuation(hfGain, length, occ_hf);
	}
	
	public float computeLFAtt(float lfGain, double length){
		return computeAttenuation(lfGain, length, occ_lf);
	}
	
	
	
	/////////////////////////////////////////////////
	///// getters and setters
	/////////////////////////////////////////////////
	
	
	
	public float getOcc_hf() {
		return occ_hf;
	}
	
	
	public float[] getColor() {
		return color;
	}

	public void setColor(float[] color) {
		this.color = color;
	}

	public void setOcc_hf(float occ_hf) {
		this.occ_hf = occ_hf;
	}
	
	public float getOcc_lf() {
		return occ_lf;
	}
	
	
	public void setOcc_lf(float occ_lf) {
		this.occ_lf = occ_lf;
	}
	
	
	
	
}
